/*
 * 英才科技有限公司 版权所有 2021-2025
 */
package cn.edu.tyu.finance.thingstype.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import cn.edu.tyu.finance.thingstype.domain.copy.users;
import cn.edu.tyu.finance.util.DbUtil;

/**
*
 * @author mengjingyi
 *@version 1.0

 */
public class UserDaoImpl {
    public int addUser(users users) throws SQLException {
    	Connection conn= DbUtil.getConnection();
    	String sql ="insert into users values(?,?,?)";
    	PreparedStatement ps=conn.prepareStatement(sql);
    	ps.setString(1, users.getUserid());
    	ps.setString(2, users.getUsername());
    	ps.setString(3, users.getUserpsw());
    	int res= ps.executeUpdate();
    	DbUtil.backconn(conn, ps, null);
    	return res;
    }
    public static void main(String[] args) throws SQLException {
		UserDaoImpl userDao=new UserDaoImpl();
		users users=new users();
		users.setUserid("1");
		users.setUsername("zs");
		users.setUserpsw("123456");
		int res =userDao.addUser(users);
		System.out.println("res="+res);
	}
}
